# Replication for correlation analysis, part of the online appendix
# Krawatzek / Soroka
# Defending History? The Impact of Context and Speaker in Russia
# Perspectives on Politics
# DOI

require(corrplot)
setwd("Insert your local directory")
load("CorrelationAnalysisDF.RData")

datamatrix <- cor(CorrelationAnalysisDF, use = "everything")
corrplot(datamatrix, method="number")

# recoding into four groups
CorrelationAnalysisDF$GroupRevisionist <- ifelse(CorrelationAnalysisDF$D11ProStalin==1|CorrelationAnalysisDF$B10Positive==1, 1,0)
CorrelationAnalysisDF$GroupNoClearView <- ifelse(CorrelationAnalysisDF$D11Undecided==1|CorrelationAnalysisDF$B10Undecided==1, 1,0)
CorrelationAnalysisDF$GroupCritical <- ifelse(CorrelationAnalysisDF$D11AntiStalin==1|CorrelationAnalysisDF$B10Negative==1, 1,0)
CorrelationAnalysisDF$GroupPoliticallyLoyal <- ifelse(CorrelationAnalysisDF$B7RUTrustState==1|CorrelationAnalysisDF$F1StateTV==1|CorrelationAnalysisDF$H2AgainstProtest==1, 1,0)